package com.random.fox.whatspay.greendao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * Created by 渠 on 2014/11/7.
 */
public class BaseDao {

    private static BaseDao baseDao = null;

    private String DATABASE_NAME = "yingke.db";   //数据库名称
    private SQLiteDatabase db;
    private DaoMaster daoMaster;
    private DaoSession daoSession;

    private BaseDao(Context context) {

        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(context, DATABASE_NAME, null);
        db = helper.getWritableDatabase();
        daoMaster = new DaoMaster(db);
        daoSession = daoMaster.newSession();
    }

    public synchronized static BaseDao getInstance(Context context) {
        if (baseDao == null) {
            baseDao = new BaseDao(context);
        }
        return baseDao;
    }

//    public UploadDao getUploadDao() {
//        return daoSession.getUploadDao();
//    }

}